
#ifndef _C_PARAM_SERVER_H_
#define _C_PARAM_SERVER_H_

#pragma once
#include "direct.h"

using namespace std;

class CparamServer
{
public:
	static CparamServer* instance();

	bool IsVisualize() { return isVisualize != 0; }
	bool UseGryoBack() { return use_gyro_back > 0; }
	bool InGroundTestMode() { return ground_test_mode == 1; }
	int ImageWidth() { return image_width; }
	int ImageHeight() { return image_height; }
	int IndexCamLeft() { return index_cam_left; }
	int IndexCamRight() { return index_cam_right; }
	int SADWindowSize() { return sad_window_size; }
	int NumberDisparity() { return number_disparity; }
	int ViewportNumber() { return viewport_number; }
	int NeiborghRadius() { return neiborgh_radius; }
	int NeiborghMinNum() { return viewport_number; }
	int LogLevel() { return log_level; }	
	float VoxelUnit() { return voxel_unit; }
	float KinectHeight() { return kinect_height; }
	float LaserHeight() { return laser_height; }
	float PasswayWidth() { return passway_width; }
	float PasswayHeight() { return passway_height; }
	float MinStairHeight() { return min_stair_height; }
	float MaxStairHeight() { return max_stair_height; }
	float MinStairDepth() { return min_stair_depth; }
	float CameraHeight() { return camera_height; }
	float BiasPitch() { return bias_pitch; }
	float BiasRoll() { return bias_roll; }
	float BiasYaw() { return bias_yaw; }
	string StereoAlgorithm() { return stereo_algo; }
	string GroundTrainPath() { return ground_train_image_path; }
	string GroundTestPath() { return ground_test_image_path; }
	string VideoFilePath() { return video_filepath; }
	string ClusterMethod() { return cluster_method; }
	string StyleGyroFront() { return style_gyro_1; }
	string StyleGyroBack() { return style_gyro_2; }
	string ComGyroFront() { return com_gyro_1; }
	string ComGyroBack() { return com_gyro_2; }
	string ComLaser() { return com_laser; }
	string ComRobot() { return com_robot; }
	cv::Mat& ViewField() { return viewfield; }
	cv::Mat& ViewPort() { return viewport; }

	int CheckDir(const char* dir, bool creatDir = false);

	//#ifdef DEBUG_INFO
	void DebugPrintMat(
		cv::Mat& A, 
		string matName, 
		int rowLimit = 0,
		int colLimit = 0
		);
	//#endif

private:
	CparamServer();
	void init();

	cv::FileStorage fs;
	static CparamServer* _instance;

	int isVisualize;
	int ground_test_mode;
	int image_width;
	int image_height;
	int index_cam_left;
	int index_cam_right;
	int sad_window_size;
	int number_disparity;
	int viewport_number;
	int neiborgh_radius;
	int neiborgh_minnum;
	int log_level;
	int use_gyro_back;
	float voxel_unit;
	float kinect_height;
	float laser_height;
	float passway_width;
	float passway_height;
	float min_stair_height;
	float max_stair_height;
	float min_stair_depth;
	float camera_height;
	float bias_pitch;
	float bias_roll;
	float bias_yaw;
	string stereo_algo;
	string ground_train_image_path;
	string ground_test_image_path;
	string video_filepath;
	string cluster_method;
	string style_gyro_1;
	string style_gyro_2;
	string com_gyro_1;
	string com_gyro_2;
	string com_laser;
	string com_robot;
	cv::Mat viewfield;
	cv::Mat viewport;
};


#endif